/*
 * CreateGameWindow.h
 *
 *  Created on: 06/06/2014
 *      Author: lucio
 */

#ifndef CREATEGAMEWINDOW_H_
#define CREATEGAMEWINDOW_H_
#include <gtkmm.h>
#include <gtkmm/window.h>
#include <string>
#include "game_info.h"
#include "campaign_info.h"
#include "CampaingListModel.h"

class CreateGameWindow: public Gtk::Window {
protected:
	Glib::RefPtr<Gtk::Builder> builder;

	Gtk::Entry* GameNameEntry;
	Gtk::Button* CreateGameButton;

	Gtk::TreeView* CampaingList;
	Glib::RefPtr<Gtk::ListStore> ListStore;
	CampaingListModel model;
	std::vector<CampaingInfo> CampaingVector;
	std::string GameName;
	CampaingInfo SelectedCampaingInfo;
	bool gameCreated;

	Gtk::Image* PreviewImage;

public:
	void CreateGame();
	void SetNull();

	CreateGameWindow(BaseObjectType* object,
			const Glib::RefPtr<Gtk::Builder> &Builder);
	virtual ~CreateGameWindow();

	const CampaingInfo& getSelectedCampaingInfo() const {
		return SelectedCampaingInfo;
	}

	bool isGameCreated() const {
		return gameCreated;
	}

	void setGameCreated(bool gameCreated) {
		this->gameCreated = gameCreated;
	}

	const std::string& getGameName() const {
		return GameName;
	}

private:
	void CreateCampaingList();
	void AddCampaings();
	void ChangePreviewImage();
	void WindowSignalHide();
};

#endif /* CREATEGAMEWINDOW_H_ */
